<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Example Applications</title>
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="alias.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="alias.js"></script>

<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>


<script type="text/javascript">
  jQuery(document).ready(function () {
    if(gref){ // Number all _img and _table classes
      gref();
    }
  });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">nRF51822 BLE SDK
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('group__ble__sdk__apps.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#groups">Modules</a>  </div>
  <div class="headertitle">
<div class="title">Example Applications</div>  </div>
<div class="ingroups"><a class="el" href="group__ble__sdk.html">BLE SDK</a></div></div>
<div class="contents">

<p>Example applications implementing BLE profiles and demonstrating the use of BLE services.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="groups"></a>
Modules</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__apps__config__files.html">'Config Files'</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__apps__seq__diagrams.html">'Sequence Diagrams'</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__apps__setup.html">'Setup'</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__gzll.html">Multiprotocol Application</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__hids__keyboard.html">HID Keyboard Application</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__hids__mouse.html">HID Mouse Application</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__hrs.html">Heart Rate Application</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__proximity.html">Proximity Application</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__pwr__mgmt.html">Power Profiling Application</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__template.html">Template Application</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__ble__sdk__app__hrs__eval.html">Heart Rate Application for Evaluation Board</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>Example applications implementing BLE profiles and demonstrating the use of BLE services. </p>
<p>We have two types of example application designs:</p>
<ul>
<li><b>Using Scheduler</b>: Events are passed from interrupt level to the main loop (thread mode) using a <a class="el" href="group__app__scheduler.html">Scheduler</a>.</li>
</ul>
<ul>
<li><b>App Low only</b>: All service and application code executes in App Low interrupt level.</li>
</ul>
<p>In both designs, the example applications have many similarities:</p>
<ul>
<li><b>Main function</b>: The main function consists of a number of init function calls, followed by a small main loop. In an "App Low only" application, the main loop only handles power management. In Scheduler applications, the main loop contains a call to <a class="el" href="group__app__scheduler.html#ga6fd6a3db7526418f796c55c096360ded" title="Executes all scheduled events.">app_sched_schedule()</a> in addition to the power management.</li>
</ul>
<dl class="note"><dt><b>Note:</b></dt><dd>For more information of low power modes used in the example applications, see <a class="el" href="group__ble__sdk__app__pwr__mgmt.html#power_mgmt">Power Management</a> section in the documentation of Power profiling example.</dd></dl>
<ul>
<li><b>Service initialization</b>: All applications contain a function named services_init. This function will initialize all services to be used by the application.</li>
</ul>
<ul>
<li><b>BLE stack interrupt handler</b>: All applications include the <a class="el" href="group__ble__stack__handler.html">BLE Stack Event Handler</a> module, which contains a BLE stack interrupt handler (SWI2_IRQHandler). This interrupt handler will be called each time the stack wants to pass an event to the application. The handler reads the stack event, and passes the event to the application through a callback function. In applications using the Scheduler, this callback function is always named <a class="el" href="group__ble__sdk__app__hids__keyboard__main.html#gacf1716b2e00b3456f0733e8101ed9e0d" title="Pass bluetooth stack event to scheduler.">ble_evt_schedule()</a>, and in applications not using the Scheduler, it is always named <a class="el" href="ble__app__gzll__hr_8c.html#a2b08d6ccb6e7f4588d2ac843d4494c0e" title="Dispatches a BLE stack event to all modules with a BLE stack event handler.">ble_evt_dispatch()</a>. The callback function dispatches the event to the BLE stack event handler of all its services and modules having such a handler (either directly, or through the Scheduler). Optionally, it may also dispatch the event to an application specific BLE stack event handler.</li>
</ul>
<ul>
<li><b>Service BLE stack event handlers</b>: Services may implement their own BLE stack event handlers. These must be called when SWI2_IRQHandler (in <a class="el" href="group__ble__stack__handler.html">BLE Stack Event Handler</a>) receives a BLE event (see previous point). The handlers will react to events that are relevant to the service, while ignoring all others.</li>
</ul>
<ul>
<li><b>Application BLE stack event handler</b>: Optionally the application may implement its own BLE stack event handler. This must be called when SWI2_IRQHandler (in <a class="el" href="group__ble__stack__handler.html">BLE Stack Event Handler</a>) receives a BLE event. The handler will react to events that are relevant to the application, while ignoring all others.</li>
</ul>
<ul>
<li><b>Service event handlers</b>: The application may provide event handlers to services, letting the service inform the application about events inside the service. For some services this is optional, while for others it is mandatory.</li>
</ul>
<ul>
<li><b>Service error handlers</b>: To some services, the application may provide an error handler, letting the service inform the application about errors.</li>
</ul>
<ul>
<li><b>Assert handler</b>: Applications must implement an assert handler callback function named assert_nrf_callback. Is called directly from the application assert macro (implemented in <a class="el" href="nrf__assert_8h.html" title="Utilities for verifying program logic.">nrf_assert.h</a>).</li>
</ul>
<ul>
<li><b>LEDs common to all applications written to work on the nRFgo Motherboard (the applications inside nrf6310 folder) except <a class="el" href="group__ble__sdk__app__pwr__mgmt.html">Power Profiling Application</a> :</b><ul>
<li>LED 0: Advertising</li>
<li>LED 1: Connected</li>
<li>LED 7: Asserted (i.e. an assert check in the application has failed)</li>
</ul>
</li>
</ul>
<p>In an application using the Scheduler, instead of calling service/application event handlers directly from the <a class="el" href="group__ble__stack__handler.html">BLE Stack Event Handler</a> callback function, the callback function passes "wrapper" events to the Scheduler, and the "wrapper" event handler will call the service/application event handlers, thus making all service/application event handlers execute in thread mode.</p>
<p>When initializing the <a class="el" href="group__app__timer.html">Application Timer</a> module, applications using the <a class="el" href="group__app__scheduler.html">Scheduler</a> must supply a pointer to the <a class="el" href="group__app__scheduler.html#gad09181e10ae224ca354b5e650b5e3a0a" title="Schedules a timer event.">app_sched_timer_event_schedule()</a> function to <a class="el" href="group__app__timer.html#ga4e1da5a2f64ee78ee97f7422ea97e439" title="Initializes the timer module.">app_timer_init()</a>. This function will transfer execution of timer timeout handlers to the main loop by using the <a class="el" href="group__app__scheduler.html">Scheduler</a>.</p>
<p>See <a class="el" href="group__ble__sdk__apps__seq__diagrams.html">'Sequence Diagrams'</a> for illustrations showing the flow of events for various application scenarios, both with and without the Scheduler. </p>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">
      Copyright &copy 2006-2011 <a href="http://www.nordicsemi.no" style="text-decoration:none">Nordic Semiconductor</a>.
      All Rights Reserved.
      <a href="disclaimer.html">Disclaimer</a>
    </li>
   </ul>
 </div>


</body>
</html>
